﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/WithoutPermBasic.Master" AutoEventWireup="true" CodeBehind="PrintCertificateOxygen.aspx.cs" Inherits="PMS.UI.PM.PrintCertificateOxygen" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        //通过分析模块内部进入，传了ID
        var Id = com.get.Id;
        var action = com.get.action;
        var adjustCount = 0;
        var DetailData;
        var sqUncertainty;
        $(function () {
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "/Logic/PM/BottlePrintAjax.aspx?method=GetBottlePrintMainById",
                data: { ID: Id },
                asyn: false,
                success: function (data) {
                    var per = data.per;
                    var quo = data.quo;

                    if (per.GBCode == null || per.GBCode == "") {

                    }
                    else {
                        $("#lblGB").html("标准物质编号：" + per.GBCode);
                    }


                    // $("#lblGasName").html(per.GasName);
                    if (action == "record") {
                        $("#iptGasName").val(per.AnaMethod);
                    }
                    else {
                        $("#iptGasName").val(quo.ProductName + "气体标准物质");
                    }





                    $("#lblSampleNum").html(per.BottleCode);
                    sqUncertainty = per.Uncertainty;

                    $("#GuiGE").html(quo.BottleVolume);
                    $("#Pressure").html(per.Pressure);

                    $("#spnKvalue").html(per.kValue);
                    $("#iptDeadLine").val(per.PrintDeadline);

                    JsBarcode("#imgBarcode", per.SerialCode, {
                        width: 2.6,//设置条之间的宽度
                        height: 87,//高度
                        displayValue: true,//是否在条形码下方显示文字
                    });

                    $("#iptConfirmDate").val(per.ConfirmDate);
                    $("#iptConfirmDate").datebox({
                        width: 120
                    });

                    $("#selIsAir").val(per.PrintIsAir);
                    $("#selIsAir").combobox({

                        data: [{ id: "0", text: "非空气打印" }, { id: "1", text: "空气底气打印" }],
                        valueField: "id",
                        textField: "text",
                        panelHeight: 'auto',
                        onSelect: function (rec) {
                            LoadDetailData(per.kValue);
                        }

                    });

                    $.ajax({
                        type: "POST",
                        dataType: "json",
                        url: "/Logic/PM/BottlePrintAjax.aspx?method=GetBottlePrintDetailById",
                        data: { ID: Id },
                        asyn: false,
                        success: function (data) {

                            DetailData = data;
                            LoadDetailData(per.kValue);
                        }
                    });
                }
            });





            $("#btnPrint").click(function () {
                var gasName = $("#iptGasName").val();
                var deadLine = $("#iptDeadLine").val();
                var printIsAir = $("#selIsAir").combobox("getValue");

                try {
                    var confirmDate = $("#iptConfirmDate").datebox("getValue");
                    $("#iptConfirmDate").datebox("destroy");
                    $("#lblConfirmDate").html(confirmDate);
                    $("#lblConfirmDate").show();
                } catch (e) {

                }


                $("#lblGasName").html(gasName);
                $("#lblGasName").show();
                $("#iptGasName").hide();
                $("#spnDeadline").html(deadLine);
                $("#spnDeadline").show();
                $("#iptDeadLine").hide();


                $("#divPrint").print({
                    globalStyles: true,//是否包含父文档的样式，默认为true
                    mediaPrint: false,//是否包含media='print'的链接标签。会被globalStyles选项覆盖，默认为false
                    stylesheet: null,//外部样式表的URL地址，默认为null

                    noPrintSelector: ".no-print",//不想打印的元素的jQuery选择器，默认为".no-print"
                    iframe: true,//是否使用一个iframe来替代打印表单的弹出窗口，true为在本页面进行打印，false就是说新开一个页面打印，默认为true
                    append: null,//将内容添加到打印内容的后面
                    prepend: null,//将内容添加到打印内容的前面，可以用来作为要打印内容
                    deferred:
                 $.Deferred(

                        )//回调函数
                });
                if (action != "record") {
                    $.ajax({
                        type: "POST",
                        dataType: "json",
                        url: "/Logic/PM/BottlePrintAjax.aspx?method=SavePrintCertificateContent",
                        data: {
                            ID: Id,
                            url: "PrintCertificate",
                            GasName: gasName,
                            printIsAir: printIsAir,
                            deadLine: deadLine,
                            confirmDate: confirmDate
                        },
                        success: function (data) {
                            com.message(data.state, data.msg);
                        }

                    });
                }
            });


        })





        function LoadDetailData(kValue) {
            var printIsAir = $("#selIsAir").combobox("getValue");
            var data = com.FillAir(DetailData, printIsAir);

            data.splice(data.length - 1, 0, { 'GasEngName': 'THC', 'IsBottom': '0', 'PrintUnit': '2', 'PrintConcentration': '0', 'Concentration': '0.0001', 'PrintDigitNum': '2', 'GasChiName': '总烃' });
            data.splice(data.length - 1, 0, { 'GasEngName': 'CO', 'IsBottom': '0', 'PrintUnit': '2', 'PrintConcentration': '0', 'Concentration': '0.0001', 'PrintDigitNum': '2', 'GasChiName': '一氧化碳' });
            data.splice(data.length - 1, 0, { 'GasEngName': 'CO2', 'IsBottom': '0', 'PrintUnit': '2', 'PrintConcentration': '0', 'Concentration': '0.0001', 'PrintDigitNum': '2', 'GasChiName': '二氧化碳' });
            data.splice(data.length - 1, 0, { 'GasEngName': 'NO', 'IsBottom': '0', 'PrintUnit': '2', 'PrintConcentration': '0', 'Concentration': '0.0001', 'PrintDigitNum': '2', 'GasChiName': '一氧化氮' });
            data.splice(data.length - 1, 0, { 'GasEngName': 'NO2', 'IsBottom': '0', 'PrintUnit': '2', 'PrintConcentration': '0', 'Concentration': '0.0001', 'PrintDigitNum': '2', 'GasChiName': '二氧化氮' });
            var content = "";
            var concen = "";
            for (var i = 0; i < data.length; i++) {
                content += "<tr>";
                content += "<td style='font-size:20px'>";
                content += data[i].GasChiName;
                content += "</td>";

                content += "<td style='font-size:20px'>";
                content += com.ConvertLower(data[i].GasEngName);
                content += "</td>";

                content += "<td style='font-size:20px'>";
                if (data.length == 1) {
                    content += "&ge;" + data[0].BudgetConcentration + " %";
                }
                else {
                    if (data[i].IsBottom == "0") {
                        if (data[i].PrintUnit == "0" && data[i].PrintConcentration == "0") {
                            content += ConvertUnit(data[i].Concentration, "ppm", data[i].PrintDigitNum) + " mol/mol";
                        }
                        else if (data[i].PrintUnit == "0" && data[i].PrintConcentration == "1") {
                            content += ConvertUnit(data[i].AnalyseConcentration, "ppm", data[i].PrintDigitNum) + " mol/mol";
                        }
                        else if (data[i].PrintUnit == "1" && data[i].PrintConcentration == "0") {
                            content += ConvertUnit(data[i].computeMGCM, "mg", data[i].PrintDigitNum);
                        }
                        else if (data[i].PrintUnit == "1" && data[i].PrintConcentration == "1") {
                            content += ConvertUnit(data[i].actualMGCM, "mg", data[i].PrintDigitNum);
                        } else if (data[i].PrintUnit == "2") {
                            content += ConvertUnit(data[i].Concentration, "symbol", data[i].PrintDigitNum) + " mol/mol";
                        }
                    }
                    else {
                        content += "余量";
                    }
                }


                content += "</td>";
                content += "<td style='font-size:20px'>";
                if (data[i].AnalyseMethod != null) {
                    content += data[i].AnalyseMethod
                }

                content += "</td>";
                if (i == 0) {
                    content += "<td rowspan='" + data.length + "' style='font-size:20px'>";

                    if (sqUncertainty) {
                        content += "" + sqUncertainty + "%"
                    }
                    else {
                        content += "";
                    }
                    content += "</td>";
                }
                content += "</tr>";

            }
            $("#detailBody").html("");
            $("#detailBody").append(content);
        }



        function ConvertUnit(value, unit, printNum) {

            var num = new Number(value);
            result = "";
            if (unit == "ppm") {
                if (num > 0.1) {
                    result = num.toPrecision(printNum);
                    result = result + "%";
                }
                else {
                    num = num * 10000;

                    result = num.toPrecision(printNum);

                    result = result.toLocaleString() + "&times;10<sup>-6</sup>";
                }
            } else if (unit == "symbol") {
                num = num * 10000;

                result = num.toPrecision(printNum);

                result = "&lt;" + result.toLocaleString() + "&times;10<sup>-6</sup>";
            }
            else {
                //if (num > 1000) {
                //    result = (num / 100).toPrecision(printNum);
                //    result = result + "&times;10<sup>2</sup> mg/m<sup>3</sup>";
                //}
                //else {
                //    result = num.toPrecision(printNum);
                //    result = result + " mg/m<sup>3</sup>";
                //}
                result = num.toPrecision(printNum);
                result = result + " mg/m<sup>3</sup>";

            }
            return result;

        }



        //保留2位小数，如：2，还会保留2 不会补0
        function toDecimal2NoZero(x) {
            var f = Math.round(x * 100) / 100;
            var s = f.toString();
            return s;
        }

        //保留3位小数，如：2，还会保留2 不会补0
        function toDecimal3NoZero(x) {
            var f = Math.round(x * 1000) / 1000;
            var s = f.toString();
            return s;
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceToorbar" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <input type="button" id="btnPrint" value="打印" style="height: 28px; width: 100px" />
    <input id="selIsAir" name="selIsAir" style="width: 100px;" />
    <div id="divPrint" style="margin-top: 20px">
        <div id="divCover" style="border: 1px solid; width: 960px; height: 1360px; text-align: center">
            <div id="divGB" style="margin-left: 20px; text-align: left; float: left">

                <label style="font-size: 24px; font-family: Simsun,Times New Roman; margin-top: 20px; float: left">国家标准物质（NCRM）</label><div class="clear"></div>
                <br />
                <label id="lblGB" style="font-family: ' Simsun,Times New Roman'; font-size: 20px; margin-top: 10px"></label>

            </div>
            <div>
                <img id="imgBarcode" style="float: right; margin-right: 30px; margin-top: 20px" />

            </div>

            <div class="clear"></div>
            <h2 style="font-size: 44px; font-family: Simsun; margin-top: 300px">标准物质证书</h2>
            <label id="lblGasName" style="font-family: Simsun; font-size: 36px; margin-top: 10px; display: none"></label>
            <input id="iptGasName" style="font-family: SimSun; font-size: 36px; margin-top: 10px; width: 500px; text-align: center" />
            <div style="margin-top: 200px;">
                <img src="../../Images/icon-sign.png" />
            </div>


            <div style="margin-top: 200px;">
                <label style="font-family: Simsun; font-size: 24px;">定值日期：</label>
                <label style="font-family: Simsun; font-size: 24px; display: none" id="lblConfirmDate"></label>
                <input id="iptConfirmDate" style="font-family: SimSun; font-size: 36px; margin-top: 10px; width: 500px; text-align: center" />
            </div>

            <div style="margin-top: 100px">

                <label style="font-family: Simsun; font-size: 24px; margin-top: 100px">杭州新世纪混合气体有限公司</label>

                <%-- <h2 style="font-size: 24px; font-family: Simsun; margin-left: 310px; margin-top: 10px">中国杭州</h2>--%>
                <div style="margin-top: 10px">
                    <label style="font-family: Simsun; font-size: 22px; margin-top: 10px">中国</label>
                    <label style="font-family: Simsun; font-size: 22px;">杭州</label>
                </div>
                <div style="margin-top: 10px">
                    <label style="font-family: Simsun; font-size: 22px;">电话：0571—88132888</label>
                </div>
                <div style="margin-top: 10px">
                    <label style="font-family: Simsun; font-size: 22px;">技术支持：13957199218</label>
                </div>
                <div style="margin-top: 10px">
                    <label style="font-family: Simsun; font-size: 22px;">销售经理：18968080258</label>
                </div>
            </div>

        </div>
        <div id="content" style="border-top: 1px solid; width: 960px; height: 1360px; margin-top: 180px">
            <div style="margin-left: 40px; margin-top: 30px;">

                <span style="font-size: 22px; font-family: Simsun; font-weight: 800">概述</span>
            </div>
            <div style="margin-top: 10px;">


                <span style="font-size: 22px; font-family: Simsun; margin-left: 40px">本气体标准物质主要用于校准气体分析仪器与测量质量控制。
                </span>
            </div>

            <div style="margin-top: 15px;">

                <span style="font-size: 24px; font-family: Simsun; margin-left: 40px; font-weight: 600">一、标准物质制备</span>

            </div>
            <div style="margin-top: 10px;">

                <span style="font-size: 22px; font-family: Simsun; margin-left: 40px">本气体标准物质以纯度经过准确定值的组分气体为原料，采用重量法制备。</span>

            </div>

            <div style="margin-top: 15px;">

                <span style="font-size: 24px; font-family: Simsun; margin-left: 40px; font-weight: 600">二、定值方法与溯源性</span>

            </div>
            <div style="margin-top: 10px;">

                <span style="font-size: 22px; font-family: Simsun; margin-left: 40px">通过使用满足计量学特性要求的测量方法和计量器具，保证标准物质量的溯源性。本气体标准物质以重量法配制，以分析方法测定的结果作为组分浓度的标准值。各组分的物质量分数，为该组分的摩尔数与所有组分摩尔数总和之比。</span>

            </div>

            <div style="margin-top: 15px;">

                <span style="font-size: 24px; font-family: Simsun; margin-left: 40px; font-weight: 600">三、特性量值及不确定度</span>
            </div>
            <div style="margin-top: 15px; margin: 0 auto; text-align: center; font-size: 20px" id="divTable">
                <label style="font-family: Simsun; font-size: 24px;">样品编号：</label>

                <label style="font-family: Simsun; font-size: 24px;" id="lblSampleNum"></label>
                <table id="tbDetail">
                    <tr>
                        <td style="width: 120px; font-size: 20px">组分名称</td>
                        <td style="font-size: 20px; width: 120px">分子式</td>
                        <td style="width: 250px; font-size: 20px" id="conTitle">标准值</td>
                        <td style="width: 180px; font-size: 20px">分析方法</td>
                        <td style="width: 120px; font-size: 20px">相对扩展不确定度（k=<span style="font-size: 20px" id="spnKvalue"></span>）</td>
                    </tr>
                    <tbody id="detailBody">
                    </tbody>

                </table>
            </div>
            <div style="margin-top: 15px;">

                <span style="font-size: 22px; font-family: Simsun; margin-left: 40px;">标准值的不确定度由原料气纯度检测、称量过程、均匀性、稳定性考察等引入的不确定度分量合成。</span>

            </div>
            <style type="text/css">
                #tbDetail {
                    border-top: 2px solid;
                    border-bottom: 2px solid;
                    margin: 0 auto;
                }

                    #tbDetail td {
                        font-size: 24px;
                        font-family: Simsun,'Times New Roman';
                    }

                #divPrint span {
                    line-height: 26pt;
                }
            </style>
            <div style="margin-top: 15px;">

                <span style="font-size: 24px; font-family: Simsun; margin-left: 40px; font-weight: 600">四、均匀性和稳定性考察</span>
            </div>
            <div style="margin-top: 10px;">
                <span style="font-size: 22px; font-family: Simsun; margin-left: 40px">该标准物质在研制过程中用分析方法对其均匀性和稳定性进行评价，考察结果良好。本标准物质自定值日期起，有效期</span><input type="text" id="iptDeadLine" style="width: 25px; height: 40px; font-size: 22px; font-family: Simsun;" />
                <span style="font-size: 22px; font-family: Simsun; display: none" id="spnDeadline"></span>
                <span style="font-size: 22px; font-family: Simsun;">个月。</span>

            </div>
            <div style="margin-top: 15px;">

                <span style="font-size: 24px; font-family: Simsun; margin-left: 40px; font-weight: 600">五、包装、存储及使用</span>
            </div>
            <div style="margin-top: 10px;">
                <span style="font-size: 22px; font-family: Simsun; margin-left: 40px">该标准物质包装</span>
                <span id="GuiGE" style="font-family: 'Times New Roman'; font-size: 22px;"></span>
                <%--  <label id="lblGuiGe" style="font-family: 'Times New Roman';font-size: 22px;"></label>--%>
                <span style="font-size: 22px; font-family: Simsun;">升的铝合金气瓶中，充填压力</span>
                <span id="Pressure" style="font-family: 'Times New Roman'; font-size: 22px;"></span>
                <span style="font-size: 22px; font-family: Simsun;">MPa，使用压力下限为0.5MPa，使用中应选用适当的压力调节器，严格防止系统的泄漏和玷污，气瓶远离热源，避免阳光直射，防止撞击。</span>
            </div>
            <div style="margin-top: 15px;">
                <span style="font-size: 24px; font-family: Simsun; margin-left: 40px; font-weight: 600">六、声明</span>
            </div>
            <div style="margin-top: 10px; padding-top: 5px">

                <span style="font-size: 16px; font-family: Simsun; margin-left: 40px">1. 本标准物质仅供实验室研究与分析测试工作使用。</span><br />
                <span style="font-size: 16px; font-family: Simsun; margin-left: 40px">2. 因用户使用或存储不当所引发的投诉，不予承担责任。</span><br />
                <span style="font-size: 16px; font-family: Simsun; margin-left: 40px">3. 收到后请立刻核对品种、数量和包装，相关赔偿只限于标准物质本身，不涉及其他任何损失。</span><br />
                <span style="font-size: 16px; font-family: Simsun; margin-left: 40px">4. 仅对加盖“杭州新世纪混合气体有限公司 质检专用章”的完整证书负责，请妥善保管此证书。</span><br />
                <span style="font-size: 16px; font-family: Simsun; margin-left: 40px">5. 如需获得更多与应用有关的信息，请与技术咨询部门联系。</span>

            </div>
        </div>
    </div>
</asp:Content>

